/*
 * CmdClientConnect.cpp
 *
 *  Created on: Sep 22, 2016
 *      Author: ubuntu
 */

#include "CmdClientConnect.h"


CmdClientConnection::CmdClientConnection(TcpServer *m_pParent, struct connectop *op, struct sockaddr *addr)
	: ClientConnection(m_pParent, op, addr)
{
	add_head = 0;
	add_tail = 0;
	add_len = add_head + add_tail;
	debug(LOG_DEBUG, "Begin to create");
}

CmdClientConnection::~CmdClientConnection()
{
	debug(LOG_DEBUG, "Exit client");
}

bool CmdClientConnection::parsePackage(unsigned char *buf, size_t len, int add_head, int add_tail)
{
	while (len > 0) {
		if (buf[len-1] == '\r' || buf[len-1] == '\n') {
			buf[len-1] = 0;
			len--;
		} else
			break;
	}
	if (len < 3)
		return false;
	free(buf);
	return true;
}
